home *** CD-ROM | disk | FTP | other *** search
/ Building Homes of Our Own / Building Homes of our Own.iso / setup / data1.cab / Everything / working / houCons.dxr / interface_209_IntWallTileBehave.ls < prev    next >
Encoding:
Text File  |  2002-09-25  |  2.3 KB  |  98 lines

  1. property mySprite, Active, actionNum, myType, myTile, tileIconName, tileFloating, FloorPlanDisplaySprite, doubleClickDelay, startTicks, waitingToPlaceTile, clickLoc, ancestor, initted, whatPlacement, whatItem, state
  2.  
  3. on beginSprite me
  4.   mySprite = me.spriteNum
  5.   myType = #tileSprite
  6.   state = #off
  7.   ancestor = new(script("TileBehave actions"), mySprite)
  8. end
  9.  
  10. on exitFrame me
  11.   global gIsoEngineTracker, gIso
  12.   if not initted then
  13.     init(me)
  14.     initted = 1
  15.   end if
  16.   if waitingToPlaceTile then
  17.     if the ticks > (startTicks + doubleClickDelay) then
  18.       result = addFPitem(gIso, whatItem, clickLoc, whatPlacement)
  19.       waitingToPlaceTile = 0
  20.     end if
  21.   end if
  22.   if tileShouldGoInactive(me) then
  23.     goInactive(me)
  24.   else
  25.     goActive(me)
  26.   end if
  27.   if not Active then
  28.     exit
  29.   end if
  30.   if voidp(myTile) then
  31.     exit
  32.   end if
  33.   set the loc of sprite mySprite to the mouseLoc
  34. end
  35.  
  36. on mouseUp me
  37.   global gIso
  38.   clickLoc = the mouseLoc
  39.   if not Active then
  40.     exit
  41.   end if
  42.   if not tileFloating then
  43.     exit
  44.   end if
  45.   tileInfoList = SIRollover(gIso, clickLoc)
  46.   outPut("tileInfoList = " & tileInfoList)
  47.   if the ticks < (startTicks + doubleClickDelay) then
  48.     result = removeFPitem(gIso, whatItem, clickLoc, whatPlacement)
  49.     startTicks = 0
  50.     waitingToPlaceTile = 0
  51.     exit
  52.   end if
  53.   startTicks = the ticks
  54.   waitingToPlaceTile = 1
  55. end
  56.  
  57. on setTile me, aTileIconName
  58.   global gIsoEngineTracker
  59.   tileIconName = aTileIconName
  60.   actionNum = integer(word 3 of tileIconName)
  61.   whatItem = word 2 of tileIconName
  62.   case whatItem of
  63.     "InteriorWalls":
  64.       myTile = "IntWalltile" && actionNum
  65.       whatPlacement = [#nw, #ne, #se, #sw, #n, #e, #s, #w][actionNum]
  66.       if actionNum < 5 then
  67.         whatItem = #interiorwall
  68.       else
  69.         whatItem = #interiorcorner
  70.       end if
  71.   end case
  72.   set the member of sprite mySprite to member(myTile)
  73.   setTileFloating(gIsoEngineTracker, 1)
  74.   tileFloating = 1
  75. end
  76.  
  77. on killTile me
  78.   global gIsoEngineTracker
  79.   setTileFloating(gIsoEngineTracker, 0)
  80.   goInactive(me)
  81.   actionNum = VOID
  82.   myTile = VOID
  83.   tileFloating = 0
  84. end
  85.  
  86. on showProps me
  87.   PropNum = count(me)
  88.   repeat with x = 1 to PropNum
  89.     prop = 0
  90.     thisProp = getPropAt(me, x)
  91.     if thisProp = #myHandlers then
  92.       next repeat
  93.     end if
  94.     prop = string(getPropAt(me, x)) && "=" && getaProp(me, thisProp)
  95.     put prop
  96.   end repeat
  97. end
  98.